package com.行为型模型.O命令模式;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * 订单命令类，还有订单信息和执行者（厨师）信息
 */
public class OrderCommand implements Command {

    private SeniorChef seniorChef;

    private Order order;


    public OrderCommand(SeniorChef seniorChef, Order order) {
        this.seniorChef = seniorChef;
        this.order = order;
    }

    public SeniorChef getSeniorChef() {
        return seniorChef;
    }

    public void setSeniorChef(SeniorChef seniorChef) {
        this.seniorChef = seniorChef;
    }

    public Order getOrder() {
        return order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    @Override
    public void execute() {
        System.out.println("---开始做"+order.getDiningTable()+"号桌的饭");

        Set<String> keys = order.getFoodDic().keySet();
        for (String key:keys
             ) {
            seniorChef.makeFood(order.getFoodDic().get(key),key);
        }
        System.out.println(order.getDiningTable()+"号桌的饭好了");

    }
}
